package com.example.questionnaire.service.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.questionnaire.dao.QuestionnaireDao;
import com.example.questionnaire.dto.QuestionnaireAddDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.utils.PageUtils;
import com.example.common.utils.Query;

import com.example.questionnaire.dao.ProblemDao;
import com.example.questionnaire.entity.ProblemEntity;
import com.example.questionnaire.service.ProblemService;


@Service("problemService")
public class ProblemServiceImpl extends ServiceImpl<ProblemDao, ProblemEntity> implements ProblemService {
    @Autowired
    private QuestionnaireDao questionnaireDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ProblemEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",params.get("userId"));
        IPage<ProblemEntity> page = this.page(
                new Query<ProblemEntity>().getPage(params),
                wrapper
         );

        page.setTotal(page.getRecords().size());

        return new PageUtils(page);
    }
}